#include "LightPlayer.h"

namespace LightPlayer{


	LightPlayer::LightPlayer(){
		init();
	}

	void LightPlayer::init(){
		m_FilePool.clear();
		m_Files.clear();
		m_pRenderer = NULL;
	}

	void LightPlayer::update( float dt ){
		int file_number = m_Files.size();
		for (int i=0; i<file_number; i++){
			m_Files[i]->update( dt );
		}
	}

	void LightPlayer::draw(){
		if(m_pRenderer){
			int file_number = m_Files.size();
			for (int i=0; i<file_number; i++){
				m_Files[i]->draw();
			}
		}
	}

	void LightPlayer::SetRenderer( LightAbstractRenderer* pRenderer ){
		m_pRenderer = pRenderer;
	}

	void LightPlayer::OpenSwfFile( const char* filename ){
		LightFile* newFile = m_FilePool.getNew();
		newFile->init();
		newFile->open( filename );
		m_Files.push_back( newFile );
	}

};